load noisdopp
dwtmode('per');
T = wpdec(noisdopp,5,'sym4');
plot(T)
wpc = wpcoef(T,16);
% wpc is length 64
rwpc = wprcoef(T,16);
% rwpc is length 1024
plot(noisdopp,'k'); hold on;
plot(rwpc,'b','linewidth',2);
axis tight;
% Determine the optimum binary wavelet packet tree.

Topt = besttree(T);
% plot the best tree
plot(Topt)

% Reconstruct an approximation to the signal from the (3,0) doublet (node 7).
rsig = wprcoef(Topt,7);
% rsig is length 1024
plot(noisdopp,'k'); hold on;
plot(rsig,'b','linewidth',2);
axis tight;

Node = depo2ind(2,[3 0]);